package com.itheima.edu.info.manager.dao.impl;

import com.itheima.edu.info.manager.dao.IStudentDao;
import com.itheima.edu.info.manager.pojo.Student;

import java.util.ArrayList;

public class StudentDaoImpl implements IStudentDao {

    private static ArrayList<Student> list = new ArrayList<>();

    /*
     * 静态代码块 -StudentDaoImpl首次加载的时候 会运行一次 之后不再运行 可以用于测试 开发完成之后删除
     */
    static {
        list.add(new Student("A001111111","老铁","18"));
    }

    @Override
    public boolean addStudent(Student stu) {
        list.add(stu);
        return true;
    }

    @Override
    public ArrayList<Student> findAllStudent() {
        return list;
    }
}
